{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[1;32mUntitled-1.ipynb 单元格 1\u001b[0m line \u001b[0;36m9\n\u001b[0;32m      <a href='vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W3sdW50aXRsZWQ%3D?line=5'>6</a>\u001b[0m     label\u001b[39m.\u001b[39mpack()\n\u001b[0;32m      <a href='vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W3sdW50aXRsZWQ%3D?line=6'>7</a>\u001b[0m     root\u001b[39m.\u001b[39mmainloop()\n\u001b[1;32m----> <a href='vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W3sdW50aXRsZWQ%3D?line=8'>9</a>\u001b[0m create_window()\n",
      "\u001b[1;32mUntitled-1.ipynb 单元格 1\u001b[0m line \u001b[0;36m7\n\u001b[0;32m      <a href='vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W3sdW50aXRsZWQ%3D?line=4'>5</a>\u001b[0m label \u001b[39m=\u001b[39m tk\u001b[39m.\u001b[39mLabel(root, text\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mHello, Tkinter!\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m      <a href='vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W3sdW50aXRsZWQ%3D?line=5'>6</a>\u001b[0m label\u001b[39m.\u001b[39mpack()\n\u001b[1;32m----> <a href='vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W3sdW50aXRsZWQ%3D?line=6'>7</a>\u001b[0m root\u001b[39m.\u001b[39;49mmainloop()\n",
      "File \u001b[1;32mc:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py:1504\u001b[0m, in \u001b[0;36mMisc.mainloop\u001b[1;34m(self, n)\u001b[0m\n\u001b[0;32m   1502\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mmainloop\u001b[39m(\u001b[39mself\u001b[39m, n\u001b[39m=\u001b[39m\u001b[39m0\u001b[39m):\n\u001b[0;32m   1503\u001b[0m \u001b[39m    \u001b[39m\u001b[39m\"\"\"Call the mainloop of Tk.\"\"\"\u001b[39;00m\n\u001b[1;32m-> 1504\u001b[0m     \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mtk\u001b[39m.\u001b[39;49mmainloop(n)\n",
      "File \u001b[1;32mc:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py:1962\u001b[0m, in \u001b[0;36mCallWrapper.__call__\u001b[1;34m(self, *args)\u001b[0m\n\u001b[0;32m   1959\u001b[0m     \u001b[39mself\u001b[39m\u001b[39m.\u001b[39msubst \u001b[39m=\u001b[39m subst\n\u001b[0;32m   1960\u001b[0m     \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mwidget \u001b[39m=\u001b[39m widget\n\u001b[1;32m-> 1962\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__call__\u001b[39m(\u001b[39mself\u001b[39m, \u001b[39m*\u001b[39margs):\n\u001b[0;32m   1963\u001b[0m \u001b[39m    \u001b[39m\u001b[39m\"\"\"Apply first function SUBST to arguments, than FUNC.\"\"\"\u001b[39;00m\n\u001b[0;32m   1964\u001b[0m     \u001b[39mtry\u001b[39;00m:\n",
      "\u001b[1;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "import tkinter as tk\n",
    "\n",
    "def create_window():\n",
    "    root = tk.Tk()\n",
    "    label = tk.Label(root, text=\"Hello, Tkinter!\")\n",
    "    label.pack()\n",
    "    root.mainloop()\n",
    "\n",
    "create_window()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tkinter \n",
    "import tkinter.messagebox\n",
    "import random\n",
    "import threading\n",
    "import itertools\n",
    "import time\n",
    "\n",
    "root = tkinter.Tk()\n",
    "#窗口标题\n",
    "root.title(\"随机提问\")\n",
    "root.title(\"随机提问\")\n",
    "#窗口初始大小和位置\n",
    "root.geometry(\"260x180+400+300\")\n",
    "#不允许改变窗口大小\n",
    "root.resizable(False,False)\n",
    "\n",
    "#关闭程序时执行的函数代码，停止滚动显示学生名单\n",
    "def close_window():\n",
    "    root.flag = False\n",
    "    time.sleep(0.1)\n",
    "    root.destroy()\n",
    "root.protocol(\"WM_DELETE_WINDOW\",close_window)\n",
    "\n",
    "#模拟学生名单，可以加上数据库访问接口，从数据库中读取学生名单\n",
    "students = ['张三','李四','王五','赵六','周七','钱八']\n",
    "#变量用来控制是否滚动显示学生名单\n",
    "root.flag = False\n",
    "\n",
    "def switch():\n",
    "    root.flag = True\n",
    "    #随机打乱学生名单\n",
    "    t = students[:]\n",
    "    random.shuffle(t)\n",
    "    t = itertools.cycle(t)\n",
    "\n",
    "    while root.flag:\n",
    "        #滚动显示\n",
    "        lbFirst['text'] = ibSecond['text'] \n",
    "        lbSecond['text'] = ibThird['text']\n",
    "        lbThird['text'] = next(t)\n",
    "\n",
    "        #数字可以修改，控制滚动速度\n",
    "        time.sleep(0.1)\n",
    "    def bthStartClick():\n",
    "        #每次单机'开始'按钮启动新线程\n",
    "        t = threading.Thread(target=switch)\n",
    "        t.start()\n",
    "    bthStart['state'] = 'disabled'\n",
    "    bthStop['state'] = 'normal'\n",
    "    bthStart = tkinter.Button(root,text='开始',command=bthStartClick)\n",
    "    btnStart.place(x=30,y=10,width=80,height=20)\n",
    "\n",
    "    def bthStopClick():\n",
    "        #单击'停'按钮停止滚动显示\n",
    "        root.flag = False\n",
    "        time.sleep(0.3)\n",
    "        tkinter.messagebox.showinfo('恭喜','本次中奖：'+lbThird['text'])\n",
    "        bthStart['state'] = 'normal'\n",
    "        bthStop['state'] = 'disabled'\n",
    "    bthStop = tkinter.Button(root,text='停',command=bthStopClick)\n",
    "    btnStop['state'] = 'disabled'\n",
    "    btnStop.place(x=150,y=10,width=80,height=20)\n",
    "\n",
    "    #用来滚动显示学生名单的3个Label主件\n",
    "    #可以根据需要进行添加，但要修改上面的线程函数代码\n",
    "    lbFirst = tkinter.Label(root,text='')\n",
    "    lbFirst.place(x=80,y=60,width=100,height=20)\n",
    "\n",
    "    #红色label组件，表示中奖名单\n",
    "    lbSecond = tkinter.Label(root,text='')\n",
    "    lbSecond['fg'] = 'red'\n",
    "    lbSecond.place(x=80,y=90,width=100,height=20)\n",
    "\n",
    "    lbThird = tkinter.Label(root,text='')\n",
    "    lbThird.place(x=80,y=120,width=100,height=20)\n",
    "\n",
    "    #启动tkinter主程序\n",
    "    root.mainloop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\2612764577.py\", line 47, in btnStartClick\n",
      "    btnStart['state']='disabled'\n",
      "    ~~~~~~~~^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1732, in __setitem__\n",
      "    self.configure({key: value})\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1721, in configure\n",
      "    return self._configure('configure', cnf, kw)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1711, in _configure\n",
      "    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))\n",
      "_tkinter.TclError: invalid command name \".!button\"\n",
      "Exception in thread Thread-5 (switch):\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 1045, in _bootstrap_inner\n",
      "    self.run()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\ipykernel\\ipkernel.py\", line 766, in run_closure\n",
      "    _threading_Thread_run(self)\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 982, in run\n",
      "    self._target(*self._args, **self._kwargs)\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\644243489.py\", line 37, in switch\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1727, in cget\n",
      "    return self.tk.call(self._w, 'cget', '-' + key)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "_tkinter.TclError: invalid command name \".!label2\"\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\2612764577.py\", line 47, in btnStartClick\n",
      "    btnStart['state']='disabled'\n",
      "    ~~~~~~~~^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1732, in __setitem__\n",
      "    self.configure({key: value})\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1721, in configure\n",
      "    return self._configure('configure', cnf, kw)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1711, in _configure\n",
      "    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))\n",
      "_tkinter.TclError: invalid command name \".!button\"\n",
      "Exception in thread Thread-6 (switch):\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 1045, in _bootstrap_inner\n",
      "    self.run()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\ipykernel\\ipkernel.py\", line 766, in run_closure\n",
      "    _threading_Thread_run(self)\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 982, in run\n",
      "    self._target(*self._args, **self._kwargs)\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\644243489.py\", line 37, in switch\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1727, in cget\n",
      "    return self.tk.call(self._w, 'cget', '-' + key)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "_tkinter.TclError: invalid command name \".!label2\"\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\2612764577.py\", line 47, in btnStartClick\n",
      "    btnStart['state']='disabled'\n",
      "    ~~~~~~~~^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1732, in __setitem__\n",
      "    self.configure({key: value})\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1721, in configure\n",
      "    return self._configure('configure', cnf, kw)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1711, in _configure\n",
      "    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))\n",
      "_tkinter.TclError: invalid command name \".!button\"\n",
      "Exception in thread Thread-7 (switch):\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 1045, in _bootstrap_inner\n",
      "    self.run()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\ipykernel\\ipkernel.py\", line 766, in run_closure\n",
      "    _threading_Thread_run(self)\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 982, in run\n",
      "    self._target(*self._args, **self._kwargs)\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\644243489.py\", line 37, in switch\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1727, in cget\n",
      "    return self.tk.call(self._w, 'cget', '-' + key)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "_tkinter.TclError: invalid command name \".!label2\"\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\2612764577.py\", line 47, in btnStartClick\n",
      "    btnStart['state']='disabled'\n",
      "    ~~~~~~~~^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1732, in __setitem__\n",
      "    self.configure({key: value})\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1721, in configure\n",
      "    return self._configure('configure', cnf, kw)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1711, in _configure\n",
      "    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))\n",
      "_tkinter.TclError: invalid command name \".!button\"\n",
      "Exception in thread Thread-8 (switch):\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 1045, in _bootstrap_inner\n",
      "    self.run()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\ipykernel\\ipkernel.py\", line 766, in run_closure\n",
      "    _threading_Thread_run(self)\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\threading.py\", line 982, in run\n",
      "    self._target(*self._args, **self._kwargs)\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\644243489.py\", line 37, in switch\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1727, in cget\n",
      "    return self.tk.call(self._w, 'cget', '-' + key)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "_tkinter.TclError: invalid command name \".!label2\"\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\2612764577.py\", line 20, in closeWindow\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\2612764577.py\", line 20, in closeWindow\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\2612764577.py\", line 20, in closeWindow\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n",
      "Exception in Tkinter callback\n",
      "Traceback (most recent call last):\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\n",
      "    return self.func(*args)\n",
      "           ^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_19084\\1304275036.py\", line 21, in close_window\n",
      "    root.destroy()\n",
      "  File \"c:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\tkinter\\__init__.py\", line 2387, in destroy\n",
      "    self.tk.call('destroy', self._w)\n",
      "_tkinter.TclError: can't invoke \"destroy\" command: application has been destroyed\n"
     ]
    }
   ],
   "source": [
    "import tkinter\n",
    "import tkinter.messagebox\n",
    "import random\n",
    "import threading\n",
    "import itertools\n",
    "import time\n",
    "\n",
    "root=tkinter.Tk()\n",
    "#窗口标题\n",
    "root.title('随机提问')\n",
    "#窗口初始大小和位置\n",
    "root.geometry('260x180+400+300')\n",
    "#不允许改变窗口大小\n",
    "root.resizable(False,False)\n",
    "\n",
    "#关闭程序时执行的函数代码，停止滚动显示学生名单\n",
    "def closeWindow():\n",
    "    root.flag=False\n",
    "    time.sleep(0.1)\n",
    "    root.destroy()\n",
    "root.protocol('WM_DELETE_WINDOW',closeWindow)\n",
    "\n",
    "#模拟学生名单，可以加上数据库访问接口，从数据库中读取学生名单\n",
    "students=['张三','李四','王五','赵六','周七','钱八']\n",
    "#变量，用来控制是否滚动显示学生名单\n",
    "root.flag=False\n",
    "\n",
    "def switch():\n",
    "    root.flag=True\n",
    "    #随机打乱学生名单\n",
    "    t=students[:]\n",
    "    random.shuffle(t)\n",
    "    t=itertools.cycle(t)\n",
    "\n",
    "    while root.flag:\n",
    "        #滚动显示\n",
    "        lbFirst['text']=lbSecond['text']\n",
    "        lbSecond['text']=lbThird['text']\n",
    "        lbThird['text']=next(t)\n",
    "\n",
    "        #数字可以修改，控制滚动速度\n",
    "        time.sleep(0.1)\n",
    "def btnStartClick():\n",
    "    #每次单击“开始”按钮启动新线程\n",
    "    t=threading.Thread(target=switch)\n",
    "    t.start()\n",
    "    btnStart['state']='disabled'\n",
    "    btnStop['state']='normal'\n",
    "btnStart=tkinter.Button(root,text='开始',command=btnStartClick)\n",
    "btnStart.place(x=30,y=10,width=80,height=20)\n",
    "\n",
    "def btnStopClick():\n",
    "    #单击“停”按钮结束滚动显示\n",
    "    root.flag=False\n",
    "    time.sleep(0.3)\n",
    "    tkinter.messagebox.showinfo('恭喜','本次中奖：'+lbSecond['text'])\n",
    "    btnStart['state']='normal'\n",
    "    btnStop['state']='disabled'\n",
    "btnStop=tkinter.Button(root,text='停',command=btnStopClick)\n",
    "btnStop['state']='disabled'\n",
    "btnStop.place(x=150,y=10,width=80,height=20)\n",
    "\n",
    "#用来滚动显示学生名单的3个Label组件\n",
    "#可以根据需要进行添加，但要修改上面的线程函数代码\n",
    "lbFirst=tkinter.Label(root,text='')\n",
    "lbFirst.place(x=80,y=60,width=100,height=20)\n",
    "\n",
    "#红色Label组件，表示中奖名单\n",
    "lbSecond=tkinter.Label(root,text='')\n",
    "lbSecond['fg']='red'\n",
    "lbSecond.place(x=80,y=90,width=100,height=20)\n",
    "\n",
    "lbThird=tkinter.Label(root,text='')\n",
    "lbThird.place(x=80,y=120,width=100,height=20)\n",
    "\n",
    "#启动tkinter主程序\n",
    "root.mainloop()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
